package tr.com.softoval.beanscanner.util;

import java.util.Date;
import java.util.List;

import tr.com.softoval.beanscanner.config.BeanCandidateLiterals;
import tr.com.softoval.beanscanner.generator.BeanCandidateScanner;

public class Utils {
	
	public static final void log(String log) {
		System.out.println("[DEBUG]" + new Date() + BeanCandidateScanner.class.getName() + " - " + log);
	}
	
	public static final boolean isEmptyList(List<?> list) {
		return list == null || list.size() <= 0 ? true : false;
	}
	
	public static final boolean isEmptyLiteral(BeanCandidateLiterals literals) {
		return isEmptyList(literals.getAbstractLiterals()) && 
			    isEmptyList(literals.getInterfaceLiterals()) && 
				isEmptyList(literals.getAnnotationLiterals());
	}
	
	public static final String listToString(List<?> list) {
		if (isEmptyList(list)) {
			return "";
		} else {
			StringBuilder sb = new StringBuilder();
			for (Object element : list) {
				sb.append(element.toString() + ", ");
			}
			return sb.toString();
		}
	}

}
